-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/pull: Wait for pending ops to complete on error #1185
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I saw in a stack trace that the main thread was calling `exit()` even while worker threads were alive and doing sha256/write/fsync etc. for objects. The stack trace was a SEGV as the main thread was calling into library `atexit()` handlers and we were a liblz4 destructor: ``` #0 0x00007f2db790f8d4 _fini (liblz4.so.1) #1 0x00007f2dbbae1c68 __run_exit_handlers (libc.so.6) ``` (Why that library has a destructor I don't know offhand, can't find it in the source in a quick look) Anyways, global library destructors and worker threads continuing simply don't mix. Let's wait for our outstanding operations before we exit. This is also a good idea for projects using libostree as a shared library, as we don't want worker threads outliving operations. Our existing pull corruption tests exercise coverage here. I added a new `caught-error` status boolean to the progress API, and use it the commandline to tell the user that we're waiting for outstanding ops.
jlebon
reviewed
Sep 19, 2017
src/libostree/ostree-repo-pull.c
Outdated
g_queue_clear (&pull_data->scan_object_queue); | ||
g_hash_table_remove_all (pull_data->pending_fetch_metadata); | ||
g_hash_table_remove_all (pull_data->pending_fetch_deltaparts); | ||
g_hash_table_remove_all (pull_data->pending_fetch_deltaparts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/deltaparts/content/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hooray for code review! Fixup ⬇️
☀️ Test successful - status-atomicjenkins |
cgwalters
added a commit
to cgwalters/ostree
that referenced
this pull request
Sep 27, 2017
I now believe the flatpak issue we were hitting was ostreedev#1185 but let's add these tests anyways for more coverage.
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I saw in a stack trace that the main thread was calling
exit()
even whileworker threads were alive and doing sha256/write/fsync etc. for objects.
The stack trace was a SEGV as the main thread was calling into library
atexit()
handlers and we were a liblz4 destructor:(Why that library has a destructor I don't know offhand, can't find
it in the source in a quick look)
Anyways, global library destructors and worker threads continuing simply don't
mix. Let's wait for our outstanding operations before we exit. This is also a
good idea for projects using libostree as a shared library, as we don't want
worker threads outliving operations.
Our existing pull corruption tests exercise coverage here.
I added a new
caught-error
status boolean to the progress API, and use it thecommandline to tell the user that we're waiting for outstanding ops.